/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.esmp.sysml.componentmodel.profile.rtos.impl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.uml2.uml.UMLPackage;
import org.esmp.sysml.componentmodel.profile.rtos.DSmodelRunnable;
import org.esmp.sysml.componentmodel.profile.rtos.EventRunnablePort;
import org.esmp.sysml.componentmodel.profile.rtos.GenericRunnable;
import org.esmp.sysml.componentmodel.profile.rtos.HardwarePort;
import org.esmp.sysml.componentmodel.profile.rtos.RTOSFactory;
import org.esmp.sysml.componentmodel.profile.rtos.RTOSPackage;
import org.esmp.sysml.componentmodel.profile.rtos.RunnablePort;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class RTOSPackageImpl extends EPackageImpl implements RTOSPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass runnableEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass runnablePortEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass hardwarePortEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dSmodelRunnableEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass genericRunnableEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass eventRunnablePortEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see org.esmp.sysml.componentmodel.profile.rtos.RTOSPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private RTOSPackageImpl() {
		super(eNS_URI, RTOSFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link RTOSPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static RTOSPackage init() {
		if (isInited) return (RTOSPackage)EPackage.Registry.INSTANCE.getEPackage(RTOSPackage.eNS_URI);

		// Obtain or create and register package
		RTOSPackageImpl theRTOSPackage = (RTOSPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RTOSPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new RTOSPackageImpl());

		isInited = true;

		// Initialize simple dependencies
		UMLPackage.eINSTANCE.eClass();

		// Create package meta-data objects
		theRTOSPackage.createPackageContents();

		// Initialize created meta-data
		theRTOSPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theRTOSPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(RTOSPackage.eNS_URI, theRTOSPackage);
		return theRTOSPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRunnable() {
		return runnableEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getRunnable_Base_Class() {
		return (EReference)runnableEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getRunnable_Priority() {
		return (EAttribute)runnableEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRunnablePort() {
		return runnablePortEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getRunnablePort_Base_Port() {
		return (EReference)runnablePortEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getRunnablePort_QueueSize() {
		return (EAttribute)runnablePortEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getRunnablePort_Blocking() {
		return (EAttribute)runnablePortEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getRunnablePort_Waking() {
		return (EAttribute)runnablePortEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getHardwarePort() {
		return hardwarePortEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getHardwarePort_Base_Port() {
		return (EReference)hardwarePortEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDSmodelRunnable() {
		return dSmodelRunnableEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getDSmodelRunnable_BlockDiagram() {
		return (EAttribute)dSmodelRunnableEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getGenericRunnable() {
		return genericRunnableEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEventRunnablePort() {
		return eventRunnablePortEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RTOSFactory getRTOSFactory() {
		return (RTOSFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		runnableEClass = createEClass(RUNNABLE);
		createEReference(runnableEClass, RUNNABLE__BASE_CLASS);
		createEAttribute(runnableEClass, RUNNABLE__PRIORITY);

		runnablePortEClass = createEClass(RUNNABLE_PORT);
		createEReference(runnablePortEClass, RUNNABLE_PORT__BASE_PORT);
		createEAttribute(runnablePortEClass, RUNNABLE_PORT__QUEUE_SIZE);
		createEAttribute(runnablePortEClass, RUNNABLE_PORT__BLOCKING);
		createEAttribute(runnablePortEClass, RUNNABLE_PORT__WAKING);

		hardwarePortEClass = createEClass(HARDWARE_PORT);
		createEReference(hardwarePortEClass, HARDWARE_PORT__BASE_PORT);

		dSmodelRunnableEClass = createEClass(DSMODEL_RUNNABLE);
		createEAttribute(dSmodelRunnableEClass, DSMODEL_RUNNABLE__BLOCK_DIAGRAM);

		genericRunnableEClass = createEClass(GENERIC_RUNNABLE);

		eventRunnablePortEClass = createEClass(EVENT_RUNNABLE_PORT);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		UMLPackage theUMLPackage = (UMLPackage)EPackage.Registry.INSTANCE.getEPackage(UMLPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		dSmodelRunnableEClass.getESuperTypes().add(this.getRunnable());
		genericRunnableEClass.getESuperTypes().add(this.getRunnable());
		eventRunnablePortEClass.getESuperTypes().add(this.getRunnablePort());

		// Initialize classes and features; add operations and parameters
		initEClass(runnableEClass, org.esmp.sysml.componentmodel.profile.rtos.Runnable.class, "Runnable", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getRunnable_Base_Class(), theUMLPackage.getClass_(), null, "base_Class", null, 1, 1, org.esmp.sysml.componentmodel.profile.rtos.Runnable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getRunnable_Priority(), ecorePackage.getEInt(), "priority", "0", 1, 1, org.esmp.sysml.componentmodel.profile.rtos.Runnable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		initEClass(runnablePortEClass, RunnablePort.class, "RunnablePort", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getRunnablePort_Base_Port(), theUMLPackage.getPort(), null, "base_Port", null, 1, 1, RunnablePort.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getRunnablePort_QueueSize(), ecorePackage.getEInt(), "queueSize", "1", 1, 1, RunnablePort.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getRunnablePort_Blocking(), ecorePackage.getEBoolean(), "blocking", "false", 1, 1, RunnablePort.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getRunnablePort_Waking(), ecorePackage.getEBoolean(), "waking", "true", 1, 1, RunnablePort.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		initEClass(hardwarePortEClass, HardwarePort.class, "HardwarePort", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getHardwarePort_Base_Port(), theUMLPackage.getPort(), null, "base_Port", null, 1, 1, HardwarePort.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		initEClass(dSmodelRunnableEClass, DSmodelRunnable.class, "DSmodelRunnable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getDSmodelRunnable_BlockDiagram(), ecorePackage.getEString(), "blockDiagram", null, 1, 1, DSmodelRunnable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		initEClass(genericRunnableEClass, GenericRunnable.class, "GenericRunnable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(eventRunnablePortEClass, EventRunnablePort.class, "EventRunnablePort", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		// Create resource
		createResource(eNS_URI);
	}

} //RTOSPackageImpl
